package com.neuedu.his.common;

import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Page {

    private  Integer   pageNo = 1;
    private  Integer   size = 10;

    //数据
    private List data;

    //总页数
    private  Integer   pages;

    //总条数
    private  long   total;


    public static Page getInstatnce(int pageNo, List data, long total){
        int size = 10;
        return  getInstatnce(pageNo,size,data,total);
    }

    public static Page getInstatnce(int pageNo,int size , List data,long total){

        int pages = (int)(total % size == 0  ?total / size: total /size+1);
        return  new Page(pageNo,size,data,pages,total);
    }


}